home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
a_utils
/
expanded.lha
/
expanded
/
hdr
/
List.h
< prev
next >
Wrap
C/C++ Source or Header
|
1992-03-19
|
6KB
|
292 lines
//
// Linear-Affine-Projective Geometry Package
//
// List.h
//
// $Header$
//
// William J.R. Longabaugh
// University of Washington
//
// Implementation of the linear-affine-projective geometry
// package described in William J.R. Longabaugh, "An Expanded
// System for Coordinate-Free Geometric Programming", Master's
// thesis, University of Washington, 1992.
//
// Copyright (c) 1992, William J.R. Longabaugh
// Copying, use and development for non-commercial purposes permitted.
// All rights for commercial use reserved.
// This software is unsupported and without warranty; it is
// provided "as is".
//
// ***********************************************************************
#ifndef List_h
#define List_h
#include <stream.h>
#include "Lap1.h"
#include "Geom.h"
// Maximum size for local storage of list elements:
#define MAX_LOCAL_LIST 4
// ***********************************************************************
//
// Implementation note: This list implementation would be a prime
// candidate for using templates if it is ported to a C++ compiler that
// supports them!
//
// ***********************************************************************
class ScalarList: public Object
{
private:
Scalar *list;
int size;
Scalar local[MAX_LOCAL_LIST]; // Local storage for small lists
public:
// Constructors. User must exercise caution with the shortcut
// constructors, to make sure the type of the arguments matches the
// desired constructor!
ScalarList(void) {size = 0; list = (Scalar *)NULL;}
ScalarList(ScalarList &t);
ScalarList(int n);
ScalarList(Scalar s, int n);
ScalarList(Scalar s);
ScalarList(Scalar s1, Scalar s2);
ScalarList(Scalar s1, Scalar s2, Scalar s3);
ScalarList(Scalar s1, Scalar s2, Scalar s3, Scalar s4);
// Interrogation / Access:
int Length(void) {return (size);}
Scalar &operator[](int n);
// Concatenation:
ScalarList operator+(ScalarList &l);
ScalarList operator*(int i);
// Assignment:
ScalarList &operator=(ScalarList &t);
// Destructor:
~ScalarList();
// To do debug printing:
void debug_out(ostream &c, int indent);
};
// ***********************************************************************
class IntList: public Object
{
private:
int *list;
int size;
int local[MAX_LOCAL_LIST]; // Local storage for small lists
public:
// Constructors. Note how ambiguity prevents some shortcut
// constructors from being defined.
// NOTE: CFRONT 1.2 does not allow an enumerated data type to be used
// to disambiguate constructors. The compiler treats the enumerated
// type as an integer, which still creates ambiguity!
IntList(void) {size = 0; list = (int *)NULL;}
IntList(IntList &t);
IntList(int size);
IntList(int val, int size);
IntList(int element1, int element2, int element3);
IntList(int element1, int element2, int element3, int element4);
// Interrogation / Access:
int Length(void) {return (size);}
int &operator[](int n);
// Concatenation:
IntList operator+(IntList &l);
IntList operator*(int i);
// Assignment:
IntList &operator=(IntList &t);
// Destructor:
~IntList();
// To do debug printing:
void debug_out(ostream &c, int indent);
};
// ***********************************************************************
//
// Lists of arbitrary Geometric objects.
class GeObList: public Object
{
private:
GeOb *list;
int size;
GeOb local[MAX_LOCAL_LIST]; // Local storage for small lists
public:
// Constructors
GeObList(void) {size = 0; list = (GeOb *)NULL;}
GeObList(GeObList &t);
GeObList(int n);
GeObList(GeOb &g, int n);
GeObList(GeOb &m);
GeObList(GeOb &m1, GeOb &m2);
GeObList(GeOb &m1, GeOb &m2, GeOb &m3);
GeObList(GeOb &m1, GeOb &m2, GeOb &m3, GeOb &m4);
// Interrogation / Access:
int Length(void) {return (size);}
GeOb &operator[](int n);
// Concatenation:
GeObList operator+(GeObList &g);
GeObList operator*(int s);
// Assignment:
GeObList &operator=(GeObList &t);
// Destructor:
~GeObList();
// To do debug printing:
void debug_out(ostream &c, int indent);
};
// ***********************************************************************
//
// Lists of spaces:
class SpaceList: public Object
{
private:
Space *list;
int size;
Space local[MAX_LOCAL_LIST]; // Local storage for small lists
public:
// Constructors
SpaceList(void) {size = 0; list = (Space *)NULL;}
SpaceList(SpaceList &t);
SpaceList(int n);
SpaceList(Space &g, int n);
SpaceList(Space &m);
SpaceList(Space &m1, Space &m2);
SpaceList(Space &m1, Space &m2, Space &m3);
SpaceList(Space &m1, Space &m2, Space &m3, Space &m4);
// Interrogation / Access:
int Length(void) {return (size);}
Space &operator[](int n);
// Concatenation:
SpaceList operator+(SpaceList &g);
SpaceList operator*(int s);
// Assignment:
SpaceList &operator=(SpaceList &t);
// Destructor:
~SpaceList();
// To do debug printing:
void debug_out(ostream &c, int indent);
};
// ***********************************************************************
//
// Lists of bases:
class BasisList: public Object
{
private:
Basis *list;
int size;
Basis local[MAX_LOCAL_LIST]; // Local storage for small lists
public:
// Constructors
BasisList(void) {size = 0; list = (Basis *)NULL;}
BasisList(BasisList &t);
BasisList(int n);
BasisList(Basis &g, int n);
BasisList(Basis &m);
BasisList(Basis &m1, Basis &m2);
BasisList(Basis &m1, Basis &m2, Basis &m3);
BasisList(Basis &m1, Basis &m2, Basis &m3, Basis &m4);
// Interrogation / Access:
int Length(void) {return (size);}
Basis &operator[](int n);
// Concatenation:
BasisList operator+(BasisList &g);
BasisList operator*(int s);
// Assignment:
BasisList &operator=(BasisList &t);
// Destructor:
~BasisList();
// To do debug printing:
void debug_out(ostream &c, int indent);
};
#endif